package org.foxas.ui
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;
	
	import org.foxas.base.FFunc;

	public class FPop extends Sprite
	{
		public var child:DisplayObject;
		public function FPop(_child:DisplayObject)
		{
			super();
			child = _child;
			this.addEventListener(Event.ADDED_TO_STAGE,addedStage);
		}
		public function addedStage(_e:Event):void{
			if(child!=null){
				this.addChild(child);
			}
			build();
			this.addEventListener(Event.REMOVED_FROM_STAGE,removedStage);
		}
		public function removedStage(_e:Event):void{
		}
		public function build():void{
			FGeom.DrawBg(this,this.stage.width,this.stage.height,0xFF6600,0.8);
			child.x = (this.stage.width-child.width)/2;
			child.y = (this.stage.height-child.height)/2;
		}
		public function hidden():void{
			FFunc.RemoveSelf(this);
		}
	}
}